home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 49 / Amiga Format CD49 (2000-01-17)(Future Publishing)(GB)(Track 1 of 3)[!][issue 2000-02].iso / -serious- / graphics / amicad / arexx_english / rotate.amicad < prev    next >
Text File  |  1999-12-06  |  1KB  |  65 lines

  1. /* Rotation d'un composant en conservant un emplacement
  2. correct de sa référence et de sa valeur.
  3. $VER: Tourner.AmiCAD 1.00e, © R.Florac, 11 octobre 1998 */
  4.  
  5. options results
  6.  
  7. signal on error
  8. signal on syntax
  9.  
  10. nr=0; objet=1
  11. 'SAVEALL(-1):OBJECTS(-1)'; objets=result
  12. do while objet>0
  13.     'O=FINDOBJ('objet',1,-1,-1)'; objet=result
  14.     if objet>0 then do
  15.     'TEST(O)'
  16.     if result>0 then do
  17.         nr=nr+1
  18.         call tourner(objet)
  19.     end
  20.     objet=objet+1
  21.     if objet>objets then objet=0
  22.     end
  23. end
  24.  
  25. if nr=0 then do
  26.     'PICKOBJ("Click on the object to rotate")'
  27.     objet=result
  28.     call tourner(objet)
  29. end
  30.  
  31. exit
  32.  
  33. tourner: procedure
  34.     parse arg o
  35.     'GETPOS(O='o')'; p=result
  36.     'ROTATE(O,1):V=GETVAL(O)'
  37.     if result>0 then do
  38.     if p=1 | p=3 then do
  39.         'MOVE(V,COL(O)-COL(V)+10,LINE(O)+HEIGHT(O)-LINE(V)+9)'
  40.     end
  41.     else do
  42.         'MOVE(V,COL(O)+WIDTH(O)-COL(V)+9,LINE(O)+HEIGHT(O)-(HEIGHT(O)-20)/2-1-LINE(V))'
  43.     end
  44.     end
  45.     'R=GETREF(O)'
  46.     if result>0 then do
  47.     if p=1 | p=3 then do
  48.         'MOVE(R,COL(O)-COL(R)+10,LINE(O)-LINE(R))'
  49.     end
  50.     else do
  51.         'MOVE(R,COL(O)+WIDTH(O)-COL(R)+9,LINE(O)+HEIGHT(O)-(HEIGHT(O)-20)/2-11-LINE(R))'
  52.     end
  53.     end
  54. return
  55.  
  56. /* Traitement des erreurs, interruption du programme */
  57. syntax:
  58. erreur=RC
  59. 'MESSAGE("Syntax error"+CHR(10)+"in line 'SIGL'"+CHR(10)+"'errortext(erreur)'")'
  60. exit
  61.  
  62. error:
  63. 'MESSAGE("Error in line 'SIGL'")'
  64. exit
  65.